$(function() {
  // 粒子线条背景
  $(document).ready(function() {
    $('.layui-container').particleground({
      dotColor: '#7ec7fd',
      lineColor: '#7ec7fd'
    })
  })


  // 登录操作
  let layer = layui.layer
  $('.layui-form').submit(function (e) {
    e.preventDefault();
 
    $.ajax({
      
      url: '/api/login',
      type: 'post',
      data: $(this).serialize(),
      success: function (res) {
        layer.msg(res.message)
        if (res.status == 0) {
        location.href="./index.html"
        localStorage.setItem('mytoken', res.token) 
             
        }
      }
    })
  })




})